﻿using System;
using System.Collections.Generic;
using System.Text;
using EnvDTE80;

namespace TSVNAddin.Core
{
	public class CommandProvider
	{
		private readonly CommandDictionary m_Commands;

		public CommandProvider(CommandDictionary commands)
		{
			m_Commands = commands;
		}

		public virtual ICommand GetCommand(string commandName)
		{
			string[] strArray = commandName.Split('.');
			int lastIndex = strArray.Length - 1;

			string commandTypeName = strArray[lastIndex];
			CommandType commandType = (CommandType)Enum.Parse(typeof(CommandType), commandTypeName);

			return m_Commands[commandType];
		}
	}
}
